﻿using mozhi.smarterp.Finance.Files;
using mozhi.smarterp.Finance.Ieps.Print;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace mozhi.smarterp.Finance.Ieps
{
    public class PrintAppService : FinanceAppService, IPrintAppService
    {
        private IServiceProvider _serviceProvider;
        public PrintAppService(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }

        public async Task<FileDto> PrintAsync(PrintQueryDto query)
        {
            var handler = PrintHandlerFactory.Instance("journal", _serviceProvider);

            var file = await handler.GetPrintFileAsync(query);

            return ObjectMapper.Map<File, FileDto>(file);
        }
    }
}
